package com.mysterlee.test;

import java.net.*;
import java.io.*;

public class TcpIpClient{
	public static void main(String args[]){
		try{
			String serverIp = "20.20.20.33";
			
			System.out.println("서버연결중. 서버 IP : "+serverIp);
			
			Socket socket = new Socket(serverIp, 7777);
			
			InputStream in = socket.getInputStream();
			DataInputStream dis = new DataInputStream(in);
			
			
			System.out.println("서버로 부터 받은 메세지: "+dis.readUTF());
			System.out.println("연결을 종료");
			
			dis.close();
			socket.close();
			System.out.println("연결 종료");
		}catch(ConnectException ce){
			ce.printStackTrace();
		}catch(IOException ie){
			ie.printStackTrace();
		}catch(Exception e){
			e.printStackTrace();
		}
	}
}